package com.waves.message.enums;

/**
 * @author wangzhiwei
 * @date 2025/01/01 15:51
 **/

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;

@AllArgsConstructor
@Getter
public enum MessageTypeEnums {
    MESSAGE(0, "消息"),

    VERIFY_CODE(1, "验证码"),
    ;

    private final Integer code;
    private final String desc;


    public static Optional<MessageTypeEnums> getEnumByCode(Integer code) {
        return Arrays.stream(MessageTypeEnums.values())
                     .filter(f -> Objects.equals(f.getCode(), code))
                     .findFirst();
    }
}
